package com.example.final_project.service.impl;

import com.example.final_project.entity.TermBook;
import com.example.final_project.mapper.TermBookMapper;
import com.example.final_project.service.TermBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TermBookServiceImpl implements TermBookService {
    @Autowired
    private TermBookMapper termBookMapper;

    @Override
    public int addTermBook(TermBook termBook) {
        return termBookMapper.insert(termBook);
    }

    @Override
    public int updateTermBook(TermBook termBook) {
        return termBookMapper.update(termBook);
    }

    @Override
    public int deleteTermBook(Long id) {
        return termBookMapper.deleteById(id);
    }

    @Override
    public TermBook getTermBookById(Long id) {
        return termBookMapper.selectById(id);
    }

    @Override
    public List<TermBook> getAllTermBooks() {
        return termBookMapper.selectAll();
    }
} 